import type { App } from "vue";
import pinia from "@/stores";
import { useUserInfoStore } from "@/stores/userInfo";
export default (app: App) => {
  app.directive("has", {
    mounted(ele, bindings) {
      // 找返回数据中按钮是否存在
      let btn = useUserInfoStore(pinia).userInfo.buttons.includes(bindings.value);
      if (!btn) {
        ele.parentNode.removeChild(ele);
      }
    },
  });
};
